//
//  SettingTableViewCell.m
//  New
//
//  Created by dlios on 15-7-22.
//  Copyright (c) 2015年 yangTao. All rights reserved.
//

#import "SettingTableViewCell.h"

@implementation SettingTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubView];
    }
    return self;
}

-(void)creatSubView{

//    UIImageView *imageV1 = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, self.frame.size.width+40, self.frame.size.height+5)];
//    imageV1.backgroundColor = [UIColor clearColor];
//    imageV1.image = [UIImage imageNamed:@"bg_share_large.png"];
//    [self addSubview:imageV1];
  
    if (WIDTH >= 375) {
        UIImageView *imageV = [[UIImageView alloc]initWithFrame:CGRectMake(self.frame.size.width-5 , 15, 25, 25)];
        imageV.backgroundColor = [UIColor clearColor];
        imageV.image = [UIImage imageNamed:@"iconfont-qianjin.png"];
        [self addSubview:imageV];
 
    }else{
        UIImageView *imageV = [[UIImageView alloc]initWithFrame:CGRectMake(self.frame.size.width-50 , 15, 25, 25)];
        imageV.backgroundColor = [UIColor clearColor];
        imageV.image = [UIImage imageNamed:@"iconfont-qianjin.png"];
        [self addSubview:imageV];

    
    }
   //    BaseUiview *view = [[BaseUiview alloc]initWithFrame:CGRectMake(0, self.frame.size.height+20, self.frame.size.width+50, 1)];
//    view.backgroundColor = [UIColor lightGrayColor];
//    [self addSubview:view];
    
    self.title = [[BaseLabel alloc]initWithFrame:CGRectMake(self.frame.size.width/5, 5, self.frame.size.width - 70, self.frame.size.height)];
    self.title.backgroundColor = [UIColor clearColor];
    self.title.font = [UIFont systemFontOfSize:18];
    [self addSubview:self.title];

    
    BaseButton *button = [[BaseButton alloc]initWithFrame:CGRectMake(50, 5, self.frame.size.width, self.frame.size.height)];
    button.backgroundColor = [UIColor clearColor];
    [self addSubview:button];
    [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.imageV = [[UIImageView alloc]initWithFrame:CGRectMake(self.frame.size.width/15, 12, 30, 30)];
    self.imageV.backgroundColor = [UIColor clearColor];
    [self addSubview:self.imageV];
    
    
}

-(void)bringString:(NSString *)string{

    if ([string isEqualToString:@"收藏"]) {
        self.title.text = string;
        self.imageV.image = [UIImage imageNamed:@"iconfont-shoucang.png"];
        
    }else if ([string isEqualToString:@"清除缓存"]){
    
        self.title.text = string;
        self.imageV.image = [UIImage imageNamed:@"iconfont-qingchuyuhuancun.png"];
    }else if ([string isEqualToString:@"夜间模式"]){
        
        self.title.text = string;
        self.imageV.image = [UIImage imageNamed:@"iconfont-yejianzhuanhuan.png"];
    
    }else if ([string isEqualToString:@"推荐好友使用"]){
    
        self.title.text = string;
        self.imageV.image = [UIImage imageNamed:@"iconfont-fenxiang.png"];

    }else if ([string isEqualToString:@"意见反馈"]){
        self.title.text = string;
        self.imageV.image = [UIImage imageNamed:@"iconfont-yijianfankui.png"];

    
    }
    else if ([string isEqualToString:@"检查更新"]){
        self.title.text = string;
        self.imageV.image = [UIImage imageNamed:@"iconfont-banbengengxin.png"];
    
    }else if ([string isEqualToString:@"关于"]){
    
        self.title.text = string;
        self.imageV.image = [UIImage imageNamed:@"iconfont-guanyu.png"];

    }
    
    
    
    
    

}


-(void)buttonAction{


    [self.myDelegate bringButton:self.title.text];

    
}

@end
